// pages/income/my-team.js
const app = getApp();
import {
  IncomeModels
} from "../../utils/models/income/Income-models";
let incomeModels = new IncomeModels;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    activeIndex: 0,
    tabList: ['我的合伙人','我的顾客'],
    partnerList : [{
      type: 1,
      name: 'xcc',
      avatar: 'https://wx.qlogo.cn/mmopen/vi_32/ibV47icLJF8mjib6FdO0XXT8xm3T9CLnfLlWBbk4B6eObicSf9cTn3UAtsSicia0O71MOhL9vkJ2f6fHStOz8rFvfZZg/132',
      total: '0.00',
      date: '2020-08-20'
    },{
      type: 1,
      name: '.',
      avatar: 'https://wx.qlogo.cn/mmopen/vi_32/ibV47icLJF8mjib6FdO0XXT8xm3T9CLnfLlWBbk4B6eObicSf9cTn3UAtsSicia0O71MOhL9vkJ2f6fHStOz8rFvfZZg/132',
      total: '0.00',
      date: '2020-08-20'
    }],
    customerList : [],
    teamCount:0
  },

  // 点击tab选项卡
  changeTab: function(e) {
    var index = e.currentTarget.dataset.index;
    this.setData({
      activeIndex: index
    },function() {
      wx.showLoading({
        title: '正在加载中...',
      })

      setTimeout(function() {
        wx.hideLoading()
      },500)
    });
  },

  getMyTeam:function(){
    var that = this;
    incomeModels.myTeam({},function(res){
      console.log(res);
      that.setData({
        partnerList:res.data.team,
        teamCount:res.data.count
      });
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getMyTeam();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})